package com.qiang.test05;

import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Map;
import java.util.Properties;
import java.util.Set;

public class Demo01 {
    public static void main(String[] args) throws IOException {
        Properties pp = new Properties();
        /*pp.put("zhangsan", "wangsan");
        pp.put("lisi", "zhaosi");
        pp.put("wangwu", "liuwu");*/

       /* Set<Object> keyset = pp.keySet();
        for (Object key : keyset) {
            Object o = pp.get(key);
            System.out.println(key+"=="+o);
        }*/
       /* pp.forEach((s,s1) -> {
            System.out.println(s+"=="+s1);
            //System.out.println(s1);
        });*/
       /* Set<Map.Entry<Object, Object>> en = pp.entrySet();
        for (Map.Entry<Object, Object> op : en) {
            Object key = op.getKey();
            Object value = op.getValue();
            System.out.println(key+"=="+value);
        }*/
       /* Object o = pp.setProperty("1", "2");
        Object o1 = pp.setProperty("3", "4");
        Object o2 = pp.setProperty("5", "6");*/
        //pp.forEach((s, s1) -> System.out.println(s + "==" + s1));
        /*//通过键，获取值
        String property = pp.getProperty("1");
        System.out.println(property);

        System.out.println("===========");

        //获取键集
        Set<String> st = pp.stringPropertyNames();
        for (String s : st) {
            System.out.println(s);
        }*/

     /*   FileWriter fw = new FileWriter("day12\\aa.txt");

        //har[] bb = {'这','个','是','我','做','的'};
        pp.store(fw, null);*/

        System.out.println("===================");

        FileReader fr = new FileReader("day12\\aa.txt");
        pp.load(fr);
        pp.forEach((s,s1) -> {
            System.out.println(s+"=="+s1);
        });

    }
}
